package com.接口;

import java.util.Arrays;
import java.util.List;
import java.util.function.Function;
import java.util.stream.Collectors;

/**
 * @author: wh(1835734390 @ qq.com)
 * @date: 2023/2/17 16:07
 * @description:
 * @version:
 */
public class FunctionTest {
    public static void main(String[] args) {
        testFunction();
    }

    public static void testFunction() {
        Function<String, Integer> function = new Function<String, Integer>() {
            @Override
            public Integer apply(String integer) {
                return integer.length();
            }
        };
        System.out.println(function.apply("hhhh"));

        List<String> aList = Arrays.asList("13.a", "3", "5");
        List newList = aList.stream().map(function).collect(Collectors.toList());
        System.out.println(newList);
    }
}
